<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<!DOCTYPE html>

<html>
<head>
    <title>Bootstrap 101 Template</title>
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
</head>
<body>
<!-- Static navbar -->
<div class="navbar navbar-default" role="navigation">
    <div class="container-fluid">
        <div class="navbar-header">
            <button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
                <span class="sr-only">Toggle navigation</span>
                <span class="icon-bar"></span>
                <span class="icon-bar"></span>
                <span class="icon-bar"></span>
            </button>
            <a class="navbar-brand" href="/index">Hadoop课程</a>
        </div>
        <div class="navbar-collapse collapse">
            <ul class="nav navbar-nav">
                <li class="dropdown">
                    <a href="#" class="dropdown-toggle" data-toggle="dropdown">云存储 <span class="caret"></span></a>
                    <ul class="dropdown-menu" role="menu">
                        <li><a href="/hadoop/file/list">我的文件</a></li>
                        <li><a href="/hadoop/goto/upload/page">上传文件</a></li>
                    </ul>
                </li>
                <li><a href="/hadoop/search">搜索</a></li>
                <li><a href="#">Link</a></li>
                <li class="dropdown">
                    <a href="#" class="dropdown-toggle" data-toggle="dropdown">Dropdown <span class="caret"></span></a>
                    <ul class="dropdown-menu" role="menu">
                        <li><a href="#">Action</a></li>
                        <li><a href="#">Another action</a></li>
                        <li><a href="#">Something else here</a></li>
                        <li class="divider"></li>
                        <li class="dropdown-header">Nav header</li>
                        <li><a href="#">Separated link</a></li>
                        <li><a href="#">One more separated link</a></li>
                    </ul>
                </li>
            </ul>

            <ul class="nav navbar-nav navbar-right">

                <div class="navbar-collapse collapse">
                    <c:choose>
                        <c:when test="${not empty user}">
                            <form class="navbar-form navbar-right" role="form" action="/web_hadoop/login_out"
                                  method="post">
                                <div class="form-group">
                                    <label>您好！${user.userName}</label>
                                </div>
                                <button type="submit" class="btn btn-success">注销</button>
                            </form>
                        </c:when>
                        <c:otherwise>
                            <form class="navbar-form navbar-right" role="form" action="/web_hadoop/login/post"
                                  method="post">

                                <div class="form-group">
                                    <input name="userName" type="text" placeholder="用户名" class="form-control">
                                </div>
                                <div class="form-group">
                                    <input name="password" type="password" placeholder="密码" class="form-control">
                                </div>
                                <button type="submit" class="btn btn-success">登录</button>
                                <button formaction="/user/register" type="submit" class="btn btn-success">注册</button>
                            </form>
                        </c:otherwise>
                    </c:choose>
                </div>
            </ul>
        </div><!--/.nav-collapse -->
    </div><!--/.container-fluid -->
</div>
</body>
</html>